package com.yy.design.pattern.chain.of.responsibility.openaccount;

import com.yy.design.pattern.chain.of.responsibility.AbstractChainHandler;
import com.yy.design.pattern.chain.of.responsibility.ChainHandlerContext;
import org.springframework.stereotype.Component;

@Component
public class OpenAccountHandler extends AbstractChainHandler {

    private AbstractChainHandler firstHandler;

    public OpenAccountHandler(Check1Handler check1Handler, Check2Handler check2Handler, Check3Handler check3Handler) {
        check1Handler.setNextHandler(check2Handler).setNextHandler(check3Handler);
        this.firstHandler = check1Handler;
    }

    @Override
    public void handle(ChainHandlerContext handlerContext) {
        this.firstHandler.handle(handlerContext);
    }
}
